package com.xpertline.ui.config;

import javax.swing.ButtonGroup;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.border.TitledBorder;

import org.jdesktop.beansbinding.AutoBinding;
import org.jdesktop.beansbinding.AutoBinding.UpdateStrategy;
import org.jdesktop.beansbinding.BeanProperty;
import org.jdesktop.beansbinding.Bindings;

import com.mimi.entity.PointSetting;
import com.mimi.enumtype.PeriodTimeEnum;
import com.xpertline.ui.factory.ComboBoxFactory;
import com.xpertline.ui.factory.CommonLabelFactory;
import com.xpertline.ui.factory.CommonTextFieldFactory;
import com.xpertline.ui.factory.PanelFactory;
import com.xpertline.ui.factory.PeriodComboBox;
import com.xpertline.ui.factory.RadioFactory;
import com.xpertline.ui.factory.TitleFactory;

public class PointPane extends JPanel {
	private JTextField tfdPAmount;
	private JTextField tfdPPoint;
	private JTextField tfdPPercent;
	private JTextField tfdPMinAmount;
	private JTextField tfdPUseableMultiplePoint;
	private JTextField tfdPPeriod;
	private final ButtonGroup buttonGroup = new ButtonGroup();
	/**
	 * @wbp.nonvisual location=44,-1
	 */
	private final PointSetting pointSetting = new PointSetting();
	private JComboBox cbxPPeriodTimeType;

	/**
	 * Create the panel.
	 */
	public PointPane() {
		JPanel panel = PanelFactory.createJPanel();
		panel.setBorder(new TitledBorder(null, "C\u00E1ch t\u00EDnh \u0111i\u1EC3m", TitledBorder.LEADING, TitledBorder.TOP, null, null));
		
		JPanel panel_1 = PanelFactory.createJPanel();
		panel_1.setBorder(new TitledBorder(null, "S\u1EED d\u1EE5ng \u0111i\u1EC3m", TitledBorder.LEADING, TitledBorder.TOP, null, null));
		
		JPanel panel_2 = PanelFactory.createJPanel();
		panel_2.setBorder(new TitledBorder(null, "Th\u1EDDi k\u00EC t\u00EDnh \u0111i\u1EC3m", TitledBorder.LEADING, TitledBorder.TOP, null, null));
		GroupLayout groupLayout = new GroupLayout(this);
		groupLayout.setHorizontalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addGap(30)
					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
						.addComponent(panel, GroupLayout.DEFAULT_SIZE, 558, Short.MAX_VALUE)
						.addComponent(panel_1, GroupLayout.DEFAULT_SIZE, 558, Short.MAX_VALUE)
						.addComponent(panel_2, GroupLayout.DEFAULT_SIZE, 558, Short.MAX_VALUE))
					.addGap(82))
		);
		groupLayout.setVerticalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addGap(34)
					.addComponent(panel, GroupLayout.PREFERRED_SIZE, 122, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.UNRELATED)
					.addComponent(panel_1, GroupLayout.PREFERRED_SIZE, 67, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.UNRELATED)
					.addComponent(panel_2, GroupLayout.PREFERRED_SIZE, 71, GroupLayout.PREFERRED_SIZE)
					.addContainerGap(123, Short.MAX_VALUE))
		);
		
		JLabel lblimThngC = CommonLabelFactory.createCommonJLabel();
		lblimThngC.setText("\u0110i\u1EC3m th\u01B0\u1EDFng c\u00F3 hi\u1EC7u l\u1EF1c trong");
		
		tfdPPeriod = CommonTextFieldFactory.createJTextField();
		
		cbxPPeriodTimeType = PeriodComboBox.createJComboBox();
		
		JLabel lblquHnTr = CommonLabelFactory.createCommonJLabel();
		lblquHnTr.setText("(Qu\u00E1 h\u1EA1n tr\u1EDF v\u1EC1 0)");
		GroupLayout gl_panel_2 = new GroupLayout(panel_2);
		gl_panel_2.setHorizontalGroup(
			gl_panel_2.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_panel_2.createSequentialGroup()
					.addContainerGap()
					.addComponent(lblimThngC)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(tfdPPeriod, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(cbxPPeriodTimeType, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(lblquHnTr)
					.addContainerGap(134, Short.MAX_VALUE))
		);
		gl_panel_2.setVerticalGroup(
			gl_panel_2.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_panel_2.createSequentialGroup()
					.addContainerGap()
					.addGroup(gl_panel_2.createParallelGroup(Alignment.BASELINE)
						.addComponent(lblimThngC)
						.addComponent(tfdPPeriod, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
						.addComponent(cbxPPeriodTimeType, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
						.addComponent(lblquHnTr))
					.addContainerGap(40, Short.MAX_VALUE))
		);
		panel_2.setLayout(gl_panel_2);
		
		JLabel lblSimS = CommonLabelFactory.createCommonJLabel();
		lblSimS.setText("S\u1ED1 \u0111i\u1EC3m s\u1EED d\u1EE5ng l\u00E0 b\u1ED9i s\u1ED1 c\u1EE7a");
		
		tfdPUseableMultiplePoint = CommonTextFieldFactory.createJTextField();
		
		JLabel lblim_1 = CommonLabelFactory.createCommonJLabel();
		lblim_1.setText("\u0111i\u1EC3m");
		GroupLayout gl_panel_1 = new GroupLayout(panel_1);
		gl_panel_1.setHorizontalGroup(
			gl_panel_1.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_panel_1.createSequentialGroup()
					.addContainerGap()
					.addComponent(lblSimS)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(tfdPUseableMultiplePoint, GroupLayout.PREFERRED_SIZE, 73, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(lblim_1)
					.addContainerGap(198, Short.MAX_VALUE))
		);
		gl_panel_1.setVerticalGroup(
			gl_panel_1.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_panel_1.createSequentialGroup()
					.addContainerGap()
					.addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE)
						.addComponent(lblSimS)
						.addComponent(tfdPUseableMultiplePoint, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
						.addComponent(lblim_1))
					.addContainerGap(86, Short.MAX_VALUE))
		);
		panel_1.setLayout(gl_panel_1);
		
		JRadioButton radioButton = RadioFactory.createJRadioButton();
		buttonGroup.add(radioButton);
		radioButton.setText("");
		
		tfdPAmount = CommonTextFieldFactory.createJTextField();
		
		JLabel lblVnTchLy = CommonLabelFactory.createCommonJLabel();
		lblVnTchLy.setText("VN\u0110 t\u00EDch l\u0169y \u0111\u01B0\u1EE3c");
		
		tfdPPoint = CommonTextFieldFactory.createJTextField();
		
		JLabel lblim = CommonLabelFactory.createCommonJLabel();
		lblim.setText("\u0111i\u1EC3m");
		
		JRadioButton radioButton_1 = RadioFactory.createJRadioButton();
		buttonGroup.add(radioButton_1);
		radioButton_1.setText("");
		
		JLabel lblimPhtSinh = CommonLabelFactory.createCommonJLabel();
		lblimPhtSinh.setText("\u0110i\u1EC3m ph\u00E1t sinh tr\u00EAn");
		
		tfdPPercent = CommonTextFieldFactory.createJTextField();
		
		JLabel lblTngim = TitleFactory.createTitle();
		lblTngim.setText("% t\u1ED5ng ti\u1EC1n");
		
		JLabel lblChTnhim = CommonLabelFactory.createCommonJLabel();
		lblChTnhim.setText("Ch\u1EC9 t\u00EDnh \u0111i\u1EC3m th\u01B0\u1EDFng tr\u00EAn");
		
		tfdPMinAmount = CommonTextFieldFactory.createJTextField();
		
		JLabel lblTrLn = CommonLabelFactory.createCommonJLabel();
		lblTrLn.setText("VN\u0110 tr\u1EDF l\u00EAn");
		GroupLayout gl_panel = new GroupLayout(panel);
		gl_panel.setHorizontalGroup(
			gl_panel.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_panel.createSequentialGroup()
					.addContainerGap()
					.addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
						.addGroup(gl_panel.createSequentialGroup()
							.addComponent(radioButton)
							.addPreferredGap(ComponentPlacement.RELATED)
							.addComponent(tfdPAmount, GroupLayout.PREFERRED_SIZE, 103, GroupLayout.PREFERRED_SIZE)
							.addPreferredGap(ComponentPlacement.RELATED)
							.addComponent(lblVnTchLy)
							.addPreferredGap(ComponentPlacement.RELATED)
							.addComponent(tfdPPoint, GroupLayout.PREFERRED_SIZE, 45, GroupLayout.PREFERRED_SIZE)
							.addPreferredGap(ComponentPlacement.RELATED)
							.addComponent(lblim))
						.addGroup(gl_panel.createSequentialGroup()
							.addComponent(radioButton_1)
							.addPreferredGap(ComponentPlacement.RELATED)
							.addComponent(lblimPhtSinh)
							.addPreferredGap(ComponentPlacement.RELATED)
							.addComponent(tfdPPercent, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE)
							.addPreferredGap(ComponentPlacement.RELATED)
							.addComponent(lblTngim))
						.addGroup(gl_panel.createSequentialGroup()
							.addComponent(lblChTnhim)
							.addPreferredGap(ComponentPlacement.RELATED)
							.addComponent(tfdPMinAmount, GroupLayout.PREFERRED_SIZE, 98, GroupLayout.PREFERRED_SIZE)
							.addPreferredGap(ComponentPlacement.RELATED)
							.addComponent(lblTrLn)))
					.addContainerGap(114, Short.MAX_VALUE))
		);
		gl_panel.setVerticalGroup(
			gl_panel.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_panel.createSequentialGroup()
					.addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
						.addComponent(radioButton)
						.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
							.addComponent(tfdPAmount, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
							.addComponent(lblVnTchLy)
							.addComponent(tfdPPoint, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
							.addComponent(lblim)))
					.addPreferredGap(ComponentPlacement.UNRELATED)
					.addGroup(gl_panel.createParallelGroup(Alignment.TRAILING)
						.addComponent(radioButton_1)
						.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
							.addComponent(lblimPhtSinh)
							.addComponent(tfdPPercent, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
							.addComponent(lblTngim)))
					.addPreferredGap(ComponentPlacement.UNRELATED)
					.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
						.addComponent(lblChTnhim)
						.addComponent(tfdPMinAmount, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
						.addComponent(lblTrLn))
					.addContainerGap(24, Short.MAX_VALUE))
		);
		panel.setLayout(gl_panel);
		setLayout(groupLayout);
		initDataBindings();

	}
	protected void initDataBindings() {
		BeanProperty<PointSetting, Boolean> pointSettingBeanProperty = BeanProperty.create("pAmount.naN");
		BeanProperty<JTextField, String> jTextFieldBeanProperty = BeanProperty.create("text");
		AutoBinding<PointSetting, Boolean, JTextField, String> autoBinding = Bindings.createAutoBinding(UpdateStrategy.READ_WRITE, pointSetting, pointSettingBeanProperty, tfdPAmount, jTextFieldBeanProperty);
		autoBinding.bind();
		//
		BeanProperty<PointSetting, Boolean> pointSettingBeanProperty_1 = BeanProperty.create("pPercent.naN");
		BeanProperty<JTextField, String> jTextFieldBeanProperty_2 = BeanProperty.create("text");
		AutoBinding<PointSetting, Boolean, JTextField, String> autoBinding_2 = Bindings.createAutoBinding(UpdateStrategy.READ_WRITE, pointSetting, pointSettingBeanProperty_1, tfdPPercent, jTextFieldBeanProperty_2);
		autoBinding_2.bind();
		//
		BeanProperty<PointSetting, Integer> pointSettingBeanProperty_2 = BeanProperty.create("pPoint");
		BeanProperty<JTextField, String> jTextFieldBeanProperty_1 = BeanProperty.create("text");
		AutoBinding<PointSetting, Integer, JTextField, String> autoBinding_1 = Bindings.createAutoBinding(UpdateStrategy.READ_WRITE, pointSetting, pointSettingBeanProperty_2, tfdPPoint, jTextFieldBeanProperty_1);
		autoBinding_1.bind();
		//
		BeanProperty<PointSetting, Integer> pointSettingBeanProperty_3 = BeanProperty.create("pMinAmount");
		BeanProperty<JTextField, String> jTextFieldBeanProperty_3 = BeanProperty.create("text");
		AutoBinding<PointSetting, Integer, JTextField, String> autoBinding_3 = Bindings.createAutoBinding(UpdateStrategy.READ_WRITE, pointSetting, pointSettingBeanProperty_3, tfdPMinAmount, jTextFieldBeanProperty_3);
		autoBinding_3.bind();
		//
		BeanProperty<PointSetting, Integer> pointSettingBeanProperty_4 = BeanProperty.create("pUseableMultiplePoint");
		BeanProperty<JTextField, String> jTextFieldBeanProperty_4 = BeanProperty.create("text");
		AutoBinding<PointSetting, Integer, JTextField, String> autoBinding_4 = Bindings.createAutoBinding(UpdateStrategy.READ_WRITE, pointSetting, pointSettingBeanProperty_4, tfdPUseableMultiplePoint, jTextFieldBeanProperty_4);
		autoBinding_4.bind();
		//
		BeanProperty<PointSetting, Integer> pointSettingBeanProperty_5 = BeanProperty.create("pPeriod");
		BeanProperty<JTextField, String> jTextFieldBeanProperty_5 = BeanProperty.create("text");
		AutoBinding<PointSetting, Integer, JTextField, String> autoBinding_5 = Bindings.createAutoBinding(UpdateStrategy.READ_WRITE, pointSetting, pointSettingBeanProperty_5, tfdPPeriod, jTextFieldBeanProperty_5);
		autoBinding_5.bind();
		//
		BeanProperty<PointSetting, PeriodTimeEnum> pointSettingBeanProperty_6 = BeanProperty.create("pPeriodTimeType");
		BeanProperty<JComboBox, Object> jComboBoxBeanProperty = BeanProperty.create("selectedItem");
		AutoBinding<PointSetting, PeriodTimeEnum, JComboBox, Object> autoBinding_6 = Bindings.createAutoBinding(UpdateStrategy.READ_WRITE, pointSetting, pointSettingBeanProperty_6, cbxPPeriodTimeType, jComboBoxBeanProperty);
		autoBinding_6.bind();
	}
}
